<script type="text/javascript">
    var panel;
    function getPDF() {
        var startDate = $('#startdate').val();
        if (startDate == '') {
            $('#startdate').attr('class', 'error');
            return;
        } else {
            $('#startdate').attr('class', 'success');
        }
        var endDate = $('#end').val();
        if (endDate == '') {
            $('#end').attr('class', 'error');
            return;
        } else {
            $('#end').attr('class', 'success');
        }
        var data = $('#reportForm').serialize();
        var url = 'index.php?r=pdf/taxreport&' + data;
        window.open(url);
    }


</script>
<?php
$this->breadcrumbs = array(
    'Report',
);?>
<h1>Sales Tax Report</h1>

<div class="form">

    <?php
    echo CHtml::form('', 'post', array('id' => 'reportForm'));
    ?>


    <div class="row">
        <?php echo CHtml::label('Start date', 'startdate'); ?>
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(

            'name' => 'startdate',
            //  'value' => CTimestamp::formatDate('m/d/Y', time()),
            'options' => array('startdate' => 'm-d-yy'),
        ));     ?>
    </div>
    <div class="row">
        <?php echo CHtml::label('End date', 'enddate'); ?>
        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker', array(

            'name' => 'enddate',
            //  'value' => CTimestamp::formatDate('m/d/Y', time()),
            'options' => array('start' => 'm-d-yy'),
        ));     ?>
    </div>
    <div class="row privileges-list">
        <?php echo CHtml::label('Department','department');?>
        
        <?php 
        $departments = SalesDepartments::getListData();
        array_shift($departments);
        echo CHtml::checkBoxList('department', '', $departments);?>
    </div>

    <div class="row ">
        <?php echo CHtml::link('Download in PDF', '#', array('id' => 'reportPDF',
        'onclick' => 'javascript:getPDF();')) ?>
    </div>
    <?
    echo CHtml::endForm();
    ?>
    <div id="job-list"></div>
</div>